package com.moonshineproject.plugin.actionscript.as3parser.vo
{
	import __AS3__.vec.Vector;
	
	import com.moonshineproject.plugin.actionscript.as3parser.completers.AccessLevels;
	
	[RemoteClass(alias="v1.ClassVO")]
	public class ClassVO
	{	
		public var name:String;
		public var members:Vector.<MemberBase> = new Vector.<MemberBase>();
		
		public var extendsClass:String;
		public var implementsInterface:String;
		
		public var packageName:String;
		
		public function getFullyQualifiedName():String
		{
			if (packageName)
			{
				return packageName + "." + name;
			}
			
			return name;
		}
		
		public function getMember(name:String):MemberBase
		{
			for (var i:int = 0; i < members.length; i++)
			{
				if (members[i].name == name) return members[i];
			}
			
			return null;
		}
		
		public function getInstanceMembers(accessLevel:int):Vector.<MemberBase>
		{
			var list:Vector.<MemberBase> = new Vector.<MemberBase>();
						
			for (var i:int = 0; i < members.length; i++)
			{
				if (members[i].accessor >= accessLevel)
				{ 
					list[list.length] = members[i];
				}
			}
			
			return list;
		}
	}
}